using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using BaseForum.Mockup;

namespace WebForum
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            //WebForumMockup.GenerateMockup();
            Application["ActiveUsers"] = 0;
        }

        protected void Application_End(object sender, EventArgs e)
        {
            Application["ActiveUsers"] = 0;
        }

        protected void Session_Start(Object sender, EventArgs e)
        {
            Session.Timeout = 20;
            Session["Start"] = "Now";
            Application.Lock();
            Application["ActiveUsers"] = System.Convert.ToInt32(Application["ActiveUsers"]) + 1;
            Application.UnLock();
        }
        protected void Session_End(Object sender, EventArgs e)
        {
            Application.Lock();
            Application["ActiveUsers"] = System.Convert.ToInt32(Application["ActiveUsers"]) - 1;
            Application.UnLock();
        }
    }
}